<extend name="Base/common" />
<block name="body">
		<include file="Public/return_nav" />
		<footer class="ui-footer ui-footer-stable ui-border-t ui-btn-group ui-whitespace">
			<a href="#" class="ui-btn-lg ui-btn-danger sure_return_wuliu">确定</a>
		</footer>
		<section class="ui-container">
			<form action="" id="myForm">
				<div class="ui-form ui-whitespace ui-form-logistics">
			        <div class="ui-form-item ui-border-b">
			            <label>物流公司</label>
			            <input type="text" placeholder="物流公司名称" name="wl_name" id="wl_name" value="{$data.wl_name|default=''}">
			        </div>
			        <div class="ui-form-item ui-border-b">
			            <label>运单号</label>
			            <input type="text" placeholder="快递公司运单号" name="wl_order" id="wl_order" value="{$data.wl_order|default=''}">
			        </div>
			        <div class="ui-form-item ui-form-item-textarea">
			            <label>备注</label>
			            <textarea placeholder="如有多个包裹寄回，请注明其运单信息" name="user_msg" id="user_msg">{$data.user_msg|default=''}</textarea>
			        </div>
				</div>
				<input type="hidden" name="return_order_id" value="{$data.return_order_id}">
			</form>
		</section>
</block>
<block name="script">
	<script type="text/javascript">
		$('.sure_return_wuliu').tap(function(){
			var wl_name = $('#wl_name').val(),
				wl_order = $('#wl_order').val();
			if(wl_name.length == 0){
				$.tips({content:'物流公司名称不能为空！',stayTime:2000,type:"success"});
				return false;
			}
			if(wl_order.length == 0){
				$.tips({content:'运单号不能为空！',stayTime:2000,type:"success"});
				return false;
			}
			$.ajax({
				url: "{:U('ReturnGoods/updateReturn')}",
				type: 'POST',
				data: $('#myForm').serialize(),
				dataType: 'json',
				error: function(){
					$.tips({content:'连接服务器失败！',stayTime:2000,type:"success"});
				},
				beforeSend:function(){
					el = $.loading({content:'加载中...'})
				},
				success: function(r){
					el.loading("hide");
					if(r.status){
						$.tips({content:r.info,stayTime:2000,type:"success"});
						window.location.href = r.url;
					}else{
						$.tips({content:r.info,stayTime:2000,type:"success"});
					}
				}
			});
		});
	</script>
</block>